/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Visitor;

/**
 *
 * @author Marcel
 */
class Wheel implements CarElement {
    private String name;
 
    public Wheel(String name) {
        this.name = name;
    }
 
    public String getName() {
        return this.name;
    }
 
    public void accept(CarElementVisitor visitor) {
   /*
    * Wheel.accept(CarElementVisitor) overrides CarElement.accept(CarElementVisitor), so the call 
    * to accept is bound at run time. This can be considered the first dispatch.
    * The decision to call CarElementVisitor.visit(Wheel) however, rather than the other 'visit'
    * methods in CarElementVisitor, can be made during compile time since 'this' is known at compile 
    * time to be a Wheel. Moreover, each subclass of CarElementVisitor overrides the visit(Wheel),
    * which is another decision that is made at run time. This can be considered the second dispatch.
    */ 
    visitor.visit(this);
    }
}
